package com.bjpowernode;

import jakarta.annotation.Resource;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;

import java.util.HashMap;
import java.util.Map;

@MapperScan(value = {"com.bjpowernode.mappers"})
@SpringBootApplication
public class DlykServerApplication implements CommandLineRunner {
    @Resource
    private RedisTemplate<String, Object> redisTemplate;
    public static final Map<String, Object> cacheMap = new HashMap<>();

    public static void main(String[] args) {
        SpringApplication.run(DlykServerApplication.class, args);
    }

    @Override
    public void run(String... args) {
        redisTemplate.setKeySerializer(RedisSerializer.string());
        redisTemplate.setValueSerializer(RedisSerializer.json());
        redisTemplate.setHashKeySerializer(RedisSerializer.string());
        redisTemplate.setHashValueSerializer(RedisSerializer.string());
    }
}
